<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Travel Dream</title>
</h:head>
<link
rel="stylesheet"
href="customerHome.css"
type="text/css"
media="all"/>

<h:body onload="#tableBean.selectedTravel">
	<div id="templatemo_maincontainer">
<div id="templatemo_topsection">
  <div id="templatemo_title">TRAVEL Dream COMPANY</div>
  <div id="templatemo_slogan">The best way to travel !</div>
  <div id="hello"><h:outputText value="Hello #{userBean.getName()} !" /></div>
 
</div>
<div id="templatemo_left_column">
  <div id="templatemo_menu_top"></div>
  <div class="templatemo_menu"> 
  <ul>
   	 <li><a href="customerHome.xhtml">Home</a></li>
    <li><a href="myTravels.xhtml">My Travels</a></li>
    <li><a href="myInvitations.xhtml">My Invitations</a></li>
    <li><a href= "../logoutRedirect.xhtml">Logout</a></li>
  </ul></div>
  <div id="templatemo_contact">
    <strong>QUICK CONTACT<br /></strong>
Tel: 001-100-1000<br />
Fax: 002-200-2000<br />
Email: info[at]templatemo.com</div>
</div>
<div id="templatemo_right_column">
  <div class="innertube">
    <h1>My invitations</h1>

<div>

<h:form id="form">  
  
    <p:growl id="msgs" showDetail="true" />  
     
		       
  
    <p:dataTable id="travels" var="travel" value="#{myInvitationsBean.getTravels(userBean.getUsername())}">  
  
  		 <p:column headerText="Place" style="width:11%">  
            <h:outputText value="#{travel.getMeanOfTransportation1().getTrip().toString()}" />  
        </p:column>  
        <p:column headerText="Dates" style="width:15%">  
            <h:outputText value="#{travel.getDateOfDepartureFormat()} - #{travel.getDateOfReturnFormat()}" />  
        </p:column>  
 
  
        <p:column headerText="Hotel" style="width:24%">  
            <strong><h:outputText value="#{travel.getHotelBean().getName()}" />  </strong>
            <br/>

            <h:outputText value="#{travel.getHotelBean().getClassification()} stars" />  
            <br/>
            <strong><h:outputText value="Adress :" /> </strong>
            <h:outputText value="#{travel.getHotelBean().getStreetNumber()} #{travel.getHotelBean().getStreetName()}" />  
            <br/>
        </p:column>  
  
        <p:column headerText="Excursions" style="width:34%">  
            <h:outputText value="#{travel.getExcursionsList()}" />  
        </p:column>  
        
         <p:column headerText="Transportation" style="width:21%">  
            <strong><h:outputText value="Go : " /></strong>          
            <br/>
            <h:outputText value="#{travel.getMeanOfTransportation1().getTransportationType().toString()}" />
            <br/>
            <h:outputText value="Departure time : #{travel.getMeanOfTransportation1().getDepartureTime()}" />
            <br/>
            <h:outputText value="Duration : #{travel.getMeanOfTransportation1().getDuration()} min" />
            <br/>
            <strong><h:outputText value="Return : " /></strong>          
            <br/>
            <h:outputText value="#{travel.getMeanOfTransportation2().getTransportationType().toString()}" />
            <br/>
            <h:outputText value="Departure time : #{travel.getMeanOfTransportation2().getDepartureTime()}" />
            <br/>
            <h:outputText value="Duration : #{travel.getMeanOfTransportation2().getDuration()} min" />
            <br/>
             </p:column>  
        
         <p:column headerText="Number of Participants" style="width:4%">  
            <h:outputText value="#{travel.getNomberOfPeople()}" />  
        </p:column>  
        
         <p:column headerText="Cost per person" style="width:4%">  
            <h:outputText value="#{travel.getPrice()} euros" />  
        </p:column>  
        
        
        
  
        <p:column style="width:5%"> 
         	<p:commandButton id="joinButton" oncomplete="PF('joinDialog').show()"  value="Join"  title="View" process="@this">  
               	 <f:setPropertyActionListener value="#{travel}" target="#{myInvitationsBean.selectedTravel}" />  
			</p:commandButton>  
				 
				 <p:dialog header="Join" widgetVar="joinDialog" resizable="false" id="joinDlg"  
                showEffect="fade" hideEffect="fade" modal="true">  
  		
  
  		<p:outputPanel id="joinDetail" style= "text-align:center;border:0;">  

            <h:panelGrid  columns="1" cellpadding="5" style= "text-align:center;border:0;">  

  			<h:outputText value="Insert the number of people who will take part of the travel :" /> 

      		 <p:spinner id="ajaxspinner" value="#{myInvitationsBean.numberOfPeople}" min="1">
                 <p:ajax process="@this" />  
             </p:spinner> 

      		 <p:commandButton type="submit" value="Join"  oncomplete="PF('joinDialog').hide()" process="@this">
      	 		 <p:ajax  listener="#{myInvitationsBean.join(userBean.getUsername(),travel)}" update=":form:msgs" />           
      		 </p:commandButton>
      		 
      	</h:panelGrid>
  	</p:outputPanel>

    </p:dialog> 
         </p:column>

    </p:dataTable>  
  
    
    
     
             
    
    
    
   
</h:form>  
                      
   </div>
    
  </div>
  
  
</div>

</div>
<div id="templatemo_footer">TravelDream Company</div>



    </h:body>
</html>


